home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / include / sys / resource.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-01  |  3.9 KB  |  120 lines

  1.  
  2. /*
  3.  * $VER: sys/resource.h 1.0 (17.4.93)
  4.  *
  5.  * (c)Copyright 1992 Obvious Implementations Corp, All Rights Reserved
  6.  */
  7.  
  8. #ifndef SYS_RESOURCE_H
  9. #define SYS_RESOURCE_H
  10.  
  11. /*
  12.  * Copyright (c) 1982, 1986 The Regents of the University of California.
  13.  * All rights reserved.
  14.  *
  15.  * Redistribution and use in source and binary forms, with or without
  16.  * modification, are permitted provided that the following conditions
  17.  * are met:
  18.  * 1. Redistributions of source code must retain the above copyright
  19.  *    notice, this list of conditions and the following disclaimer.
  20.  * 2. Redistributions in binary form must reproduce the above copyright
  21.  *    notice, this list of conditions and the following disclaimer in the
  22.  *    documentation and/or other materials provided with the distribution.
  23.  * 3. All advertising materials mentioning features or use of this software
  24.  *    must display the following acknowledgement:
  25.  *    This product includes software developed by the University of
  26.  *    California, Berkeley and its contributors.
  27.  * 4. Neither the name of the University nor the names of its contributors
  28.  *    may be used to endorse or promote products derived from this software
  29.  *    without specific prior written permission.
  30.  *
  31.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  32.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  33.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  34.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  35.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  39.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  40.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  41.  * SUCH DAMAGE.
  42.  *
  43.  *    @(#)resource.h    7.5 (Berkeley) 3/17/91
  44.  */
  45.  
  46. #ifndef _RESOURCE_H_
  47. #define _RESOURCE_H_
  48.  
  49. /*
  50.  * Process priority specifications to get/setpriority.
  51.  */
  52. #define PRIO_MIN    -20
  53. #define PRIO_MAX    20
  54.  
  55. #define PRIO_PROCESS    0
  56. #define PRIO_PGRP    1
  57. #define PRIO_USER    2
  58.  
  59. /*
  60.  * Resource utilization information.
  61.  */
  62.  
  63. #define RUSAGE_SELF    0
  64. #define RUSAGE_CHILDREN -1
  65.  
  66. struct    rusage {
  67.     struct timeval ru_utime;    /* user time used */
  68.     struct timeval ru_stime;    /* system time used */
  69.     long    ru_maxrss;        /* max resident set size */
  70. #define ru_first    ru_ixrss
  71.     long    ru_ixrss;        /* integral shared memory size */
  72.     long    ru_idrss;        /* integral unshared data " */
  73.     long    ru_isrss;        /* integral unshared stack " */
  74.     long    ru_minflt;        /* page reclaims */
  75.     long    ru_majflt;        /* page faults */
  76.     long    ru_nswap;        /* swaps */
  77.     long    ru_inblock;        /* block input operations */
  78.     long    ru_oublock;        /* block output operations */
  79.     long    ru_msgsnd;        /* messages sent */
  80.     long    ru_msgrcv;        /* messages received */
  81.     long    ru_nsignals;        /* signals received */
  82.     long    ru_nvcsw;        /* voluntary context switches */
  83.     long    ru_nivcsw;        /* involuntary " */
  84. #define ru_last     ru_nivcsw
  85. };
  86.  
  87. /*
  88.  * Resource limits
  89.  */
  90. #define RLIMIT_CPU    0        /* cpu time in milliseconds */
  91. #define RLIMIT_FSIZE    1        /* maximum file size */
  92. #define RLIMIT_DATA    2        /* data size */
  93. #define RLIMIT_STACK    3        /* stack size */
  94. #define RLIMIT_CORE    4        /* core file size */
  95. #define RLIMIT_RSS    5        /* resident set size */
  96. #define RLIMIT_MEMLOCK    6        /* locked-in-memory address space */
  97. #define RLIMIT_NPROC    7        /* number of processes */
  98. #define RLIMIT_OFILE    8        /* number of open files */
  99.  
  100. #define RLIM_NLIMITS    9        /* number of resource limits */
  101.  
  102. #define RLIM_INFINITY    0x7fffffff
  103.  
  104. struct rlimit {
  105.     long    rlim_cur;        /* current (soft) limit */
  106.     long    rlim_max;        /* maximum value for rlim_cur */
  107. };
  108.  
  109. int    getpriority (int, int);
  110. int    getrlimit (int, struct rlimit *);
  111. int    getrusage (int, struct rusage *);
  112. int    setpriority (int, int, int);
  113. int    setrlimit (int, const struct rlimit *);
  114.  
  115. #endif    /* !_RESOURCE_H_ */
  116.  
  117.  
  118. #endif
  119.  
  120.